package com.lrs.java.j2se_base.exception;

public class MyException {
	//private int id;
	
	public void checkNum(int i) throws MyException2 {
		if(i == 0){
			throw new MyException2("please input it again!",3);
		}
	}
	public static void main(String[] args){
		MyException ex = new MyException();
		try{
			ex.checkNum(1);
			ex.checkNum(0);
		}catch(MyException2 e){
			e.printStackTrace();
			System.out.println(e.getId());
		}
	}
}
class MyException2 extends Exception{
	private int id;
	
	public MyException2(String s,int id){ 
		super(s);
		this.id=id;
	}
	
	int getId(){
		return this.id;
	}
}